package com.hmall.order.utils;

public class UserHolder {
    //当前线程
    private static final ThreadLocal<Long> tdl=new ThreadLocal<>();
    //存入用户id
    public static void setUser(Long userId){
        tdl.set(userId);
    }
    //获取当前线程id
    public static Long getUser(){
        return tdl.get();
    }

    //清除
    public static void removeUser(){
        tdl.remove();
    }

}
